---
title: Calendar Block
description: Displays an 8-bit calendar block for date selection.
---

import CopyCommandButton from "@/components/copy-command-button";
import InstallationCommands from "@/components/installation-commands";
import ComponentPreview from "@/components/component-preview";
import { CalendarExample } from "@/components/examples/calendar";

<div className="flex flex-col md:flex-row items-center justify-end gap-2 mb-2">
  <CopyCommandButton
    copyCommand="pnpm dlx shadcn@latest add @8bitcn/calendar"
    command="pnpm dlx shadcn@latest add @8bitcn/calendar"
  />
</div>

<ComponentPreview title="8-bit Calendar block" name="calendar">
  <CalendarExample />
</ComponentPreview>

## Installation

---

<InstallationCommands packageName="calendar" />

## Usage

---

```tsx
import { Calendar } from "@/components/ui/8bit/calendar"
```

```tsx
// Single date selection
<Calendar
  mode="single"
  selected={date}
  onSelect={setDate}
  className="rounded-md border"
/>

// Date range selection
<Calendar
  mode="range"
  selected={dateRange}
  onSelect={setDateRange}
  numberOfMonths={2}
/>
```

